package com.lcredu.lcrliving.commodity.service.impl;

import com.lcredu.common.util.PageUtils;
import com.lcredu.common.util.Query;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.lcredu.lcrliving.commodity.dao.BrandDao;
import com.lcredu.lcrliving.commodity.entity.BrandEntity;
import com.lcredu.lcrliving.commodity.service.BrandService;


@Service("brandService")
public class BrandServiceImpl extends ServiceImpl<BrandDao, BrandEntity> implements BrandService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        //通过分析后端的代码,我们如果需要进行带条件的查询,就给QueryWrapper设置条件和参数
        //简单实现一下
//        QueryWrapper<BrandEntity> brandEntityQueryWrapper = new QueryWrapper<>();
//        brandEntityQueryWrapper.like("name", params.get("name"));

        IPage<BrandEntity> page = this.page(
                new Query<BrandEntity>().getPage(params),
                new QueryWrapper<BrandEntity>()
                //brandEntityQueryWrapper
        );

        return new PageUtils(page);
    }

}
